import request from "@/utils/request";

export const registerServer = (registerData)=>{
      const parms = new URLSearchParams();
      for (let key in registerData){
            parms.append(key,registerData[key]);
      }
      return request.post('/user/register',parms);
}

export const loginServer = (loginData)=>{
      const parms = new URLSearchParams();
      for (let key in loginData){
            parms.append(key,loginData[key]);
      }
      return request.post('/user/login',parms);
}

export const getUserinfoServer = ()=>{
      return request.get('/user/userinfo');
}

export const userlistServer = (params)=>{
      return request.get('/manager/userlist',{params:params})
}

export const updatauserServer = (addData) =>{
      const params = new URLSearchParams();
      for (let key in addData){
            params.append(key,addData[key]);
      }
      return request.put('/user/update',params)
  }
  
export const deluserServer = (id) =>{
      return request.delete('/manager/deluser/'+id)
  }

export const repasswordServer = (addData) =>{
      const params = new URLSearchParams();
      for (let key in addData){
            params.append(key,addData[key]);
      }
      return request.patch('/user/updatepwd',params)
}

export const checkpasswordServer = (password) =>{
      return request.get('/user/checkpwd/'+password)
}

export const sendemailServer = (email) =>{
      return request.get('/user/sendemail/'+email)
}

export const findpasswordServer = (addData) =>{
      const params = new URLSearchParams();
      for (let key in addData){
            params.append(key,addData[key]);
      }
      return request.patch('/user/findpwd',params)
}
 

